<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <input type="text" placeholder="请输入今天要干嘛" v-model="task">
        <button v-on:click="toAdd">add</button>
        <ul>
            <li v-for="task in taskList">
                {{task}}
            </li>
        </ul>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    var vm = new Vue({
        el:"#app",
        data:{
            task:"",
            taskList:[]
        },
        methods:{
            toAdd() {
                //this就是vm实例对象
                this.taskList.push(this.task);
                //清空输入框
                this.task=""
            }
        }
    })
</script>
</html>